<?php
namespace app\admin\validate;

use think\Validate;

class User extends Validate
{
    protected $rule = [
        'name'         => 'require|unique:user|max:50',
        'password'         => 'confirm:confirm_password|max:50',
        'confirm_password' => 'confirm:password',
        'phone'           => 'number|unique:user|length:11',
        'status'           => 'require',
    ];

    protected $message = [
        'name.require'         => '请输入用户名',
        'name.unique'          => '用户名已存在',
        'name.max'          => '用户名过长,不能超过50字符',
        'password.max'         => '密码过长,不能超过50字符',
        'password.confirm'         => '两次输入密码不一致',
        'confirm_password.confirm' => '两次输入密码不一致',
        'phone.number'            => '手机号格式错误',
        'phone.unique'          => '手机号已存在',
        'phone.length'            => '手机号长度错误',
        'status.require'           => '请选择状态'
    ];
}